package com.songxh.common;

/**
 * 基于Threadlocal封装工具类，用于保存和获取当前用户的id
 * 在拦截器处存放用户id
 *
 * @author songxh
 * @create 2022-04-24-17:56
 */
public class BaseContext {

    private static ThreadLocal<Long> threadLocal=new ThreadLocal<>();

    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }

    public static Long getCurrentId(){
        return threadLocal.get();
    }
}
